package com.xbj.mvc.utils;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import com.xbj.mvc.form.ActionForm;

public class FullBean {

	public FullBean(){
		
	}
	
	public static ActionForm full(HttpServletRequest req){
		ActionForm o = null;
		try{
			String className = req.getParameter("sign");
			Class clazz = Class.forName(className);
			o = (ActionForm)clazz.newInstance();
			Field[] f_arr = clazz.getDeclaredFields();
			for(Field f:f_arr){
				f.setAccessible(true);
				f.set(o,req.getParameter(f.getName()));
				f.setAccessible(false);
			}
			
		}catch(Exception e){
			e.printStackTrace();
		}
		return o;
	}
}
